package com.xy.biz.ts.domain.converter;

import java.util.Collection;
import java.util.List;

import com.xy.biz.ts.domain.resp.*;
import com.xy.tool.util.BeanUtilsEx;
import com.xy.biz.ts.domain.bo.TrainUserBO;
import com.xy.biz.ts.domain.po.TrainUserPO;
import com.xy.biz.ts.domain.query.TrainUserQuery;
//import com.xy.biz.ts.domain.resp.GetTrainUserResponse;
//import com.xy.biz.ts.domain.req.SaveTrainUserRequest;
//import com.xy.biz.ts.domain.req.ListTrainUserRequest;

/**
 *
 *
 * @author wwj
 * @date 2021-4-1
 */
public class TrainUserConverter {

    public static TrainUserPO toPO(TrainUserBO source) {
        return BeanUtilsEx.copyProperties(source, () -> new TrainUserPO(), true);
    }

    public static List<GetTrainUserResponse> toResponse(Collection<TrainUserBO> source) {
        return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetTrainUserResponse(), (src, tar) -> {
            tar.setLearnRecordResponses(BeanUtilsEx.copyPropertiesForNewList(src.getLearnRecordBOS(), () -> new GetLearnRecordResponse()));
            tar.setTrainDocumentRelResponses(BeanUtilsEx.copyPropertiesForNewList(src.getTrainDocumentRelBOS(), () -> new GetTrainDocumentRelResponse()));
            tar.setExaminationRecordResponses(BeanUtilsEx.copyPropertiesForNewList(src.getExaminationRecordBOS(), () -> new GetExaminationRecordResponse()));
            tar.setPracticeRecordResponses(BeanUtilsEx.copyPropertiesForNewList(src.getPracticeRecordBOS(), () -> new GetPracticeRecordResponse()));
        });
    }

    public static List<TrainUserPO> toPO(Collection<TrainUserBO> source) {
        return BeanUtilsEx.copyPropertiesForNewList(source, () -> new TrainUserPO(), true);
    }

    public static TrainUserBO fromPO(TrainUserPO source) {
        return BeanUtilsEx.copyProperties(source, () -> new TrainUserBO());
    }

    public static List<TrainUserBO> fromPO(Collection<TrainUserPO> source) {
        return BeanUtilsEx.copyPropertiesForNewList(source, () -> new TrainUserBO());
    }

//	public static TrainUserBO toBO(SaveTrainUserRequest source) {
//		return BeanUtilsEx.copyProperties(source, () -> new TrainUserBO(), true);
//	}
//
//	public static List<TrainUserBO> toBO(Collection<SaveTrainUserRequest> source) {
//		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new TrainUserBO(), true);
//	}
//
//	public static GetTrainUserResponse toResponse(TrainUserBO source) {
//		return BeanUtilsEx.copyProperties(source, () -> new GetTrainUserResponse());
//	}
//
//	public static List<GetTrainUserResponse> toResponse(Collection<TrainUserBO> source) {
//		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetTrainUserResponse());
//	}
//
//	public static TrainUserQuery toQuery(ListTrainUserRequest source) {
//		if(null == source) {
//			return null;
//		}
//		TrainUserQuery target = new TrainUserQuery(source.getPageIndex(), source.getPageSize());
//		BeanUtilsEx.copyProperties(source, target);
//		return target;
//	}

}
